package com.fenghongzhang.day006;

import androidx.appcompat.app.AppCompatActivity;

import android.Manifest;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

public class MainActivity extends AppCompatActivity implements ImageLoader.MyListener {
    private ImageView img;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        img = (ImageView) findViewById(R.id.img);

        ImageLoader.getInstance().setMyListener(this);
        requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,Manifest.permission.WRITE_EXTERNAL_STORAGE},100);
    }

    public void click(View view) {
        ImageLoader.getInstance().loading("http://www.qubaobei.com/ios/cf/uploadfile/132/9/8289.jpg");
//        img.setImageBitmap();
    }

    @Override
    public void load(Bitmap bitmap) {
        img.setImageBitmap(bitmap);
    }
}
